package com.prj.ufdm.demo.tutorial.soap;

import org.apache.commons.text.StringEscapeUtils;
import com.prj.ufdm.demo.util.UfdmRequestHttpUtil;


public class InvokeWS {

	static String reqUrl = "http://172.16.77.244:9022/trader/services/TraderService?wsdl";
	
	public static void main(String[] args) throws Exception {
		
		String data = "<data><txcode>PMC001</txcode><codeno>412728198005025768</codeno></data>";
		
		String dataEscape = StringEscapeUtils.escapeHtml4(data);
		
		String soapXml ="<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
		   "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + 
				"<soapenv:Body>" + 
					"<doTrader xmlns=\"spyne.hello.soap\">" +
						"<paramXml>"+dataEscape+"</paramXml>" + 
					"</doTrader>" + 
				"</soapenv:Body>" + 
			"</soapenv:Envelope>";
		
		
		System.out.println(soapXml);
		String soapResult = StringEscapeUtils.unescapeHtml4(UfdmRequestHttpUtil.postStream(reqUrl, null,soapXml, "utf-8"));
				
		System.out.println(soapResult.replaceAll(">", ">\n"));
		
		String abc = "";
		
	}
	

}
